﻿#region License

// // -------------------------------------------------------------------------------------
// // This information refers to Program.cs
// // 
// // Copyright 2012 ELEN7046 Group 2
// // 
// // Last Modified on: 2012-06-10
// // 
// // Contributors:
// // 
// // Amith Sewnarain
// // Elmar Vosloo
// // Jason Thorne
// // Satish Jewan
// // 
// // Wits University 
// // School of Electrical & Information Engineering
// // Software Engineering Tools and Techniques
// // 
// // -------------------------------------------------------------------------------------
// // 
// // This file (Program.cs) is part of the DishDash Event Visualization System.
// // 
// // DishDash is free software: you can redistribute it and/or modify
// // it under the terms of the GNU General Public License as published by
// // the Free Software Foundation, either version 3 of the License, or
// // (at your option) any later version.
// // 
// // DishDash is distributed in the hope that it will be useful,
// // but WITHOUT ANY WARRANTY; without even the implied warranty of
// // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// // GNU General Public License for more details.
// // 
// // You should have received a copy of the GNU General Public License
// // along with DishDash.  
// // If not, see <http://www.gnu.org/licenses/>.
// // -------------------------------------------------------------------------------------

#endregion

#region Using Directives

using System;
using InstrumentationLibrary;

#endregion

namespace InstrumentationConsoleApp
{
    internal class Program
    {
        /// <summary>
        /// Mains the specified args.
        /// </summary>
        /// <param name="args">The args.</param>
        private static void Main(string[] args)
        {
            // assumes the config is in executing directory and is called: config.xml
            var instrumentationConfigCollection = ConfigReader.Read();

            Console.WriteLine(Environment.CurrentDirectory);

            var instrumentator = new Instrumentator();
            foreach (var instrumentationConfig in instrumentationConfigCollection.InstrumentationPoints)
            {
                instrumentator.Instrument(instrumentationConfig);
            }

            var paths = instrumentator.SaveChanges();

            if (paths.Count > 0)
            {
                Console.WriteLine("The following assemblies have been re-written and saved:");
                foreach (var item in paths)
                {
                    Console.WriteLine(" - {0}", item);
                }
            }
            else
            {
                Console.WriteLine("Error: No assemblies saved");
            }
            Console.ReadLine();
        }
    }
}